Class HCC.DT.HCC2HL72.PatMergRequst Extends Ens.DataTransformDTL [ DependsOn = (EnsLib.EDI.XML.Document, EnsLib.HL7.Message) ]
{

Parameter IGNOREMISSINGSOURCE = 1;

Parameter REPORTERRORS = 1;

Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;

XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{
<transform sourceClass='EnsLib.EDI.XML.Document' targetClass='EnsLib.HL7.Message' sourceDocType='PRPA_IN201304UV02:PRPA_IN201304UV02' targetDocType='2.5.1:ADT_A18' create='new' language='objectscript' >
<assign value='source.{id().extension}' property='target.{MSH:MessageControlID}' action='set' />
<assign value='source.{creationTime().value}' property='target.{MSH:DateTimeOfMessage.Time}' action='set' />
<assign value='"ADT"' property='target.{MSH:MessageType.MessageCode}' action='set' />
<assign value='"A18"' property='target.{MSH:MessageType.TriggerEvent}' action='set' />
<assign value='source.{controlActProcess().subject().registrationEvent().replacementOf().priorRegistration().subject1.priorRegisteredRole().id().item().extension}' property='target.{MRG:PriorPatientID.IDNumber}' action='set' />
<assign value='source.{controlActProcess().subject().registrationEvent().subject1().patient().choice.patientPerson().idCategory.displayName.value}' property='target.{PID:PatientIdentifierList().IdentifierTypeCode}' action='set' />
<assign value='source.{controlActProcess().subject().registrationEvent().subject1().patient().choice.patientPerson().id.item().extension}' property='target.{PID:PatientIdentifierList().IDNumber}' action='set' />
<assign value='source.{controlActProcess().subject().registrationEvent().subject1().patient().id().item().extension}' property='target.{PID:PatientID.IDNumber}' action='set' />
<assign value='source.{controlActProcess().subject().registrationEvent().subject1().patient().effectiveTime.any.value}' property='target.{PID:PatientID.EffectiveDate}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().registrationEvent().subject1().patient().choice.patientPerson().name()})' property='target.{PID:PatientName()}' action='set' />
<assign value='source.{controlActProcess().subject().registrationEvent().custodian().assignedEntity().id().item().extension}' property='target.{EVN:OperatorID().IDNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().registrationEvent().custodian().assignedEntity().choice.assignedPerson.name()})' property='target.{EVN:OperatorID().FamilyName}' action='set' />
</transform>
}

}
